unit DialogGridFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxClasses, BaseFrm, StdCtrls, ExtCtrls, ImgList, StdActns, ActnList,
  cxStyles, cxGridBandedTableView, cxEdit, cxContainer, cxControls,
  cxInplaceContainer, cxVGrid, cxGraphics, cxEditRepositoryItems,
  DialogBaseFrm,
  DB, DBClient, alBaseDataSet, MConnect;

type
  TfrmDialogGrid = class(TfrmDialogBase)
    pnlMain: TPanel;
    vgrdMain: TcxVerticalGrid;
    rpstMainVrednost: TcxEditRepositoryMaskItem;
  private
    { Private declarations }
  protected
    procedure Loaded; override;
    procedure SetDefaultControl; override;
  public
    constructor Create(AOwner: TComponent); override;
  end;

var
  frmDialogGrid: TfrmDialogGrid;

implementation

{$R *.dfm}

{ TfrmDialog }

constructor TfrmDialogGrid.Create(AOwner: TComponent);
begin
  inherited;
  with vgrdMain do
  begin
    OptionsBehavior.AlwaysShowEditor := True;
    OptionsBehavior.GoToNextCellOnTab := True;
    OptionsBehavior.GoToNextCellOnEnter := True;
    OptionsView.CellEndEllipsis := True;
  end;
end;

procedure TfrmDialogGrid.SetDefaultControl;
var
  i: Integer;
begin
  inherited;
  for i := 0 to vgrdMain.Rows.Count - 1 do
  begin
    if vgrdMain.Rows[i] is TcxCustomEditorRow then
    begin
      vgrdMain.Rows[i].Focused := True;
      Exit;
    end;
  end;
end;

procedure TfrmDialogGrid.Loaded;
var
  i: Integer;
begin
  inherited;
  for i := 0 to vgrdMain.Rows.Count - 1 do
  begin
    if not (vgrdMain.Rows[i] is TcxCustomEditorRow) then
      vgrdMain.Rows[i].Options.TabStop := False;
  end;
end;

end.
